#import "ALTemplateEditorElementBar.h"


static NSColor *ALTemplateEditorElementBarBorderColor;
static NSGradient *ALTemplateEditorElementBarBackgroundGradient;
static const CGFloat ALTemplateEditorElementBarCornerRadius = 8.0f;;

@implementation ALTemplateEditorElementBar

+(void)initialize {
	ALTemplateEditorElementBarBorderColor = [NSColor colorWithCalibratedWhite:0.610 alpha:1.000];
	NSColor *startColor = [NSColor colorWithCalibratedWhite:0.870 alpha:1.000];
	NSColor *endColor = [NSColor colorWithCalibratedWhite:0.950 alpha:1.000];
	ALTemplateEditorElementBarBackgroundGradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:endColor];
}

-(void)drawRect:(NSRect)dirtyRect {
	NSRect borderRect = NSInsetRect([self bounds], 1.0f, 1.0f);
	NSBezierPath *borderPath = [NSBezierPath bezierPathWithRoundedRect:borderRect xRadius:ALTemplateEditorElementBarCornerRadius yRadius:ALTemplateEditorElementBarCornerRadius];
	[ALTemplateEditorElementBarBorderColor setStroke];
	[borderPath stroke];
	[ALTemplateEditorElementBarBackgroundGradient drawInBezierPath:borderPath angle:90.0f];
}

@end
